"use strict";
define(["jquery", "bootstrap", "backend", "table", "form"], function (e, t, a, i, r) {
    var o = {
        index: function () {
            i.api.init({
                extend: {
                    index_url: "wanlshop/shop/index" + location.search,
                    add_url: "wanlshop/shop/add",
                    edit_url: "wanlshop/shop/edit",
                    del_url: "wanlshop/shop/del",
                    multi_url: "wanlshop/shop/multi",
                    table: "wanlshop_shop"
                }
            });
            var t = e("#table");
            t.bootstrapTable({
                url: e.fn.bootstrapTable.defaults.extend.index_url,
                pk: "id",
                sortName: "weigh",
                columns: [[{checkbox: true,formatter:function (value,row,index) {
                        if(row.id == 1){
                            return {
                                disabled: true
                            };
                        }
                    }}, {field: "id", title: __("Id")}, {
                    field: "avatar",
                    title: __("Avatar"),
                    events: i.api.events.image,
                    formatter: i.api.formatter.image
                }, {
                    field: "state",
                    title: __("State"),
                    searchList: {0: __("State 0"), 1: __("State 1"), 2: __("State 2")},
                    formatter: i.api.formatter.normal
                }, {field: "shopname", title: __("Shopname")}, {
                    field: "user.username",
                    title: __("User.username"),
                    formatter: i.api.formatter.search
                }, {field: "city", title: __("City")}, {
                    field: "score_describe",
                    title: __("Score_describe"),
                    operate: "BETWEEN"
                }, {field: "score_service", title: __("Score_service"), operate: "BETWEEN"}, {
                    field: "score_logistics",
                    title: __("Score_logistics"),
                    operate: "BETWEEN"
                },  {
                    field: "createtime",
                    title: __("Createtime"),
                    operate: "RANGE",
                    addclass: "datetimerange",
                    formatter: i.api.formatter.datetime
                }, {
                    field: "updatetime",
                    title: __("Updatetime"),
                    operate: "RANGE",
                    addclass: "datetimerange",
                    formatter: i.api.formatter.datetime
                },  {
                    field: "operate",
                    title: __("Operate"),
                    table: t,
                    events: i.api.events.operate,
                    buttons: [
                        {
                            name: 'edit',
                            text: __(''),
                            title: __(''),
                            classname: 'btn btn-xs btn-success btn-editone',
                            icon: 'fa fa-pencil',

                            visible: function (row) {
                                //返回true时按钮显示,返回false隐藏
                                return true;
                            }
                        },
                        {
                            name: 'edit',
                            text: __(''),
                            title: __(''),
                            classname: 'btn btn-xs btn-danger btn-delone',
                            icon: 'fa fa-trash',
                            visible: function (row) {
                                //返回true时按钮显示,返回false隐藏
                                if(row.id == 1){
                                    return false;
                                }else{
                                    return true;
                                }
                            }
                        },
                    ],
                    formatter: i.api.formatter.buttons
                }]]
            }), i.api.bindevent(t)
        }, recyclebin: function () {
            i.api.init({extend: {dragsort_url: ""}});
            var t = e("#table");
            t.bootstrapTable({
                url: "wanlshop/shop/recyclebin" + location.search,
                pk: "id",
                sortName: "id",
                columns: [[{checkbox: !0}, {field: "id", title: __("Id")}, {
                    field: "deletetime",
                    title: __("Deletetime"),
                    operate: "RANGE",
                    addclass: "datetimerange",
                    formatter: i.api.formatter.datetime
                }, {
                    field: "operate",
                    width: "130px",
                    title: __("Operate"),
                    table: t,
                    events: i.api.events.operate,
                    buttons: [{
                        name: "Restore",
                        text: __("Restore"),
                        classname: "btn btn-xs btn-info btn-ajax btn-restoreit",
                        icon: "fa fa-rotate-left",
                        url: "wanlshop/shop/restore",
                        refresh: !0
                    }, {
                        name: "Destroy",
                        text: __("Destroy"),
                        classname: "btn btn-xs btn-danger btn-ajax btn-destroyit",
                        icon: "fa fa-times",
                        url: "wanlshop/shop/destroy",
                        refresh: !0
                    }],
                    formatter: i.api.formatter.operate
                }]]
            }), i.api.bindevent(t)
        }, add: function () {
            o.api.bindevent()
        }, edit: function () {
            o.api.bindevent()
        }, api: {
            bindevent: function () {
                r.api.bindevent(e("form[role=form]"))
            }
        }
    };
    return o
});